package com.gxuwz.model.vo;

import lombok.Data;

@Data
public class Result<T> {
    private final int code;
    private final String message;
    private final T data;

    public Result(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> Result<T> succeed() {
        return new Result<>(1, "成功", null);
    }

    public static <T> Result<T> succeed(T data) {
        return new Result<>(1, "成功", data);
    }

    public static <T> Result<T> error(String message) {
        return new Result<>(0, message, null);
    }
}
